home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / v cisle / autoit / autoit-v3.2.0.1-setup.exe / Examples / Helpfile / _TicksToTime.au3 < prev    next >
Text File  |  2006-06-17  |  857b  |  29 lines

  1. ; *** Demo to show a timer window
  2. #include <GUIConstants.au3>
  3. #include <Date.au3>
  4. opt("TrayIconDebug",1)
  5. Global $Secs, $Mins, $Hour, $Time
  6. ;Create GUI
  7. GUICreate("Timer",120, 50)
  8. GUICtrlCreateLabel("00:00:00", 10,10)
  9. GUISetState()
  10. ;Start timer
  11. $timer = TimerInit()
  12. AdlibEnable("Timer", 50)
  13. ;
  14. While 1
  15.  ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> before")
  16.   $msg = GUIGetMsg()
  17.  ;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after")
  18.   Select
  19.      Case $msg = $GUI_EVENT_CLOSE
  20.         Exit
  21.   EndSelect
  22. Wend
  23. ;
  24. Func Timer()
  25.   _TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs )
  26.   Local $sTime = $Time  ; save current time to be able to test and avoid flicker..
  27.   $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
  28.   If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time)
  29. EndFunc  ;==>Timer